Skip to content

[PR] fix(web): keep long-session reports within the argument limit - #7404

Merged
ranxianglei merged 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-20_keep-long-session-reports-available
Nov 20, 2026
Merged

ranxianglei merged 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-20_keep-long-session-reports-available

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Fixes #7403

Problem

The cache ledger intentionally retains the full request history, but the SVG report passes every trajectory sample to Math.max.apply. A valid 200,000-sample history throws RangeError: Maximum call stack size exceeded before the report can be downloaded.

The same report's recovery chart has three more extrema calls that expand its full sample window into function arguments. Fixing only the trajectory would move the failure to that chart.

Change

Calculate the trajectory maximum and recovery-window extrema with reductions. Every trajectory point remains in the report. Window/system reference values, the prior-round floor, the 25% outlier filter, and recovery percentages keep their existing meaning.

This removes the function-argument ceiling; it does not cap, truncate, or claim constant-memory rendering of long histories.

Validation

Tested base: 1e357bf2d6632bfbd2a74ffb70ecee1af1ec7cc3.

  • Unchanged base: 2 failing long-history regressions / 10 passing controls, with both failures showing the actual report's RangeError.
  • Fixed branch: 15/15 passed, zero skipped, across session-report and cache-ledger-large-buckets.
  • A 200,000-sample test counts all 200,000 trajectory points and verifies the last sample's maximum and request number.
  • A second 200,000-sample window preserves the measured 180K growth / 90K folded / 50% recovery result.
  • Controls retain the context-window and system-prompt axis values and the small-sample outlier rule.
  • npm run typecheck, npm run build, npm run check:unused-exports, npm run check:test-import-graph, and git diff --check pass.
  • Independent read-only review found no blocker. Full-suite verification remains the remote CI on this head.

Related history

All-author/all-state searches found no equivalent SVG-report fix. #6689 repaired the separate cache-ledger size-bucket minimum and is already in the tested base; this change covers the downstream SVG exporter. #6670 concerns history-array replacement in OpenCode/recovery hooks, and #7234 changes the browser save picker.

Reduce trajectory and recovery-window extrema without expanding retained
ledger samples into individual function arguments. Preserve every plot
point, reference axis, recovery floor and outlier threshold.

The unchanged base fails both 200,000-sample regressions; the fixed branch
passes all 15 report and large-ledger tests, typecheck, build and static
gates. This follows the separate cache-bucket fix in ranxianglei#6689; the SVG
exporter's extrema were not covered there.
@ranxianglei ranxianglei changed the title fix(web): keep long-session reports within the argument limit [PR] fix(web): keep long-session reports within the argument limit Nov 20, 2026
@ranxianglei
ranxianglei merged commit bc48307 into ranxianglei:master Nov 20, 2026
84 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Long-session SVG reports exceed the function-argument limit

2 participants